package com.aabte.weather.weartherdata.weather;

import com.aabte.weather.weather.api.WeatherApi;
import com.aabte.weather.weather.api.dto.WeatherResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Validated
@RestController
public class WeatherController implements WeatherApi {

    @Resource
    private WeatherDataService weatherDataService;

    @Override
    public WeatherResponse getReportByCityId(@PathVariable(name = "cityId") String cityId) {
        return weatherDataService.getDataByCityId(cityId);
    }

    @Override
    public WeatherResponse getReportByCityName(@PathVariable(name = "cityName") String cityName) {
        return weatherDataService.getDataByCityName(cityName);
    }

}
